package Views;

import Controllers.SupplierCTR;
import Models.*;
import Views.TableModels.SupplierTableModel;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JOptionPane;

/**
 * @author Erik
 */
public class SupplierView extends javax.swing.JFrame
{
	private SupplierCTR controller = new SupplierCTR();

    public SupplierView()
	{
        initComponents();
		findTable.addMouseListener(new MouseAdapter(){
			@Override
			public void mouseClicked(MouseEvent e){
				if (e.getClickCount() == 2)
				{
					if(findTable.getSelectedRowCount() == 1)
					{
						int chosenId = Integer.parseInt(findTable.getValueAt(findTable.getSelectedRow(), 0).toString());
						new SupplierInfoView(controller.getSupplier(chosenId)).setVisible(true);
					}
				}
			}
		 });
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        supplierTabbedPane = new javax.swing.JTabbedPane();
        addPanel = new javax.swing.JPanel();
        addDescriptionLabel = new javax.swing.JLabel();
        addNameLabel = new javax.swing.JLabel();
        addAdressLabel = new javax.swing.JLabel();
        addZipCodeLabel = new javax.swing.JLabel();
        addPhoneNoLabel = new javax.swing.JLabel();
        addContactPersonLabel = new javax.swing.JLabel();
        addCityLabel = new javax.swing.JLabel();
        addZipCodeSP = new javax.swing.JSpinner();
        addPhoneNoSP = new javax.swing.JSpinner();
        addCvrSP = new javax.swing.JSpinner();
        addNameTF = new javax.swing.JTextField();
        addAdressTF = new javax.swing.JTextField();
        addContactPersonTF = new javax.swing.JTextField();
        addCityTF = new javax.swing.JTextField();
        addCvrLabel = new javax.swing.JLabel();
        addAddButton = new javax.swing.JButton();
        findPanel = new javax.swing.JPanel();
        findDescriptionLabel = new javax.swing.JLabel();
        findNameLabel = new javax.swing.JLabel();
        findAdressLabel = new javax.swing.JLabel();
        findZipCodeLabel = new javax.swing.JLabel();
        findCityLabel = new javax.swing.JLabel();
        findPhoneNoLabel = new javax.swing.JLabel();
        findContactPersonLabel = new javax.swing.JLabel();
        findCvrLabel = new javax.swing.JLabel();
        findZipCodeSP = new javax.swing.JSpinner();
        findPhoneNoSP = new javax.swing.JSpinner();
        findCvrSP = new javax.swing.JSpinner();
        findNameTF = new javax.swing.JTextField();
        findAdressTF = new javax.swing.JTextField();
        findCityTF = new javax.swing.JTextField();
        findContactPersonTF = new javax.swing.JTextField();
        findFindButton = new javax.swing.JButton();
        findResultScrollPane = new javax.swing.JScrollPane();
        findTable = new javax.swing.JTable();
        findShowAllButton = new javax.swing.JButton();
        getPanel = new javax.swing.JPanel();
        getDescriptionLabel = new javax.swing.JLabel();
        getIdSP = new javax.swing.JSpinner();
        getIdLabel = new javax.swing.JLabel();
        getGetButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Leverandør");

        addDescriptionLabel.setText("Her kan der tilføjes leverandører");

        addNameLabel.setText("Navn:");

        addAdressLabel.setText("Adresse:");

        addZipCodeLabel.setText("Postnr:");

        addPhoneNoLabel.setText("Telefon:");

        addContactPersonLabel.setText("Kontaktperson:");

        addCityLabel.setText("By:");

        addCvrLabel.setText("CVR:");

        addAddButton.setText("Tilføj");
        addAddButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addAddButtonActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout addPanelLayout = new org.jdesktop.layout.GroupLayout(addPanel);
        addPanel.setLayout(addPanelLayout);
        addPanelLayout.setHorizontalGroup(
            addPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(addPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(addDescriptionLabel)
                .addContainerGap(196, Short.MAX_VALUE))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, addPanelLayout.createSequentialGroup()
                .addContainerGap(325, Short.MAX_VALUE)
                .add(addAddButton)
                .addContainerGap())
            .add(addPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(addPhoneNoLabel)
                .addContainerGap(348, Short.MAX_VALUE))
            .add(addPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(addPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(addNameLabel)
                    .add(addAdressLabel)
                    .add(addZipCodeLabel)
                    .add(addContactPersonLabel))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(addPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(addContactPersonTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(addPhoneNoSP, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 75, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(addAdressTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(addPanelLayout.createSequentialGroup()
                        .add(addNameTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(addCvrLabel)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(addCvrSP, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 75, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(addPanelLayout.createSequentialGroup()
                        .add(addZipCodeSP, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(addCityLabel)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(addCityTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(61, Short.MAX_VALUE))
        );
        addPanelLayout.setVerticalGroup(
            addPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(addPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(addDescriptionLabel)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(addPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(addNameLabel)
                    .add(addNameTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(addCvrLabel)
                    .add(addCvrSP, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(addPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(addAdressLabel)
                    .add(addAdressTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(addPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(addZipCodeLabel)
                    .add(addZipCodeSP, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(addCityLabel)
                    .add(addCityTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(addPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(addPhoneNoLabel)
                    .add(addPhoneNoSP, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(addPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(addContactPersonLabel)
                    .add(addContactPersonTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 142, Short.MAX_VALUE)
                .add(addAddButton)
                .addContainerGap())
        );

        supplierTabbedPane.addTab("Tilføj", addPanel);

        findDescriptionLabel.setText("Her kan der søges på leverandører");

        findNameLabel.setText("Navn:");

        findAdressLabel.setText("Adresse:");

        findZipCodeLabel.setText("Postnr:");

        findCityLabel.setText("By:");

        findPhoneNoLabel.setText("Telefon:");

        findContactPersonLabel.setText("Kontaktperson:");

        findCvrLabel.setText("CVR:");

        findFindButton.setText("Søg");
        findFindButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                findFindButtonActionPerformed(evt);
            }
        });

        findTable.setModel(new Views.TableModels.SupplierTableModel());
        findResultScrollPane.setViewportView(findTable);

        findShowAllButton.setText("Vis alle");
        findShowAllButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                findShowAllButtonActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout findPanelLayout = new org.jdesktop.layout.GroupLayout(findPanel);
        findPanel.setLayout(findPanelLayout);
        findPanelLayout.setHorizontalGroup(
            findPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(findPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(findPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(findResultScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 379, Short.MAX_VALUE)
                    .add(findDescriptionLabel)
                    .add(findPanelLayout.createSequentialGroup()
                        .add(findPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(findContactPersonLabel)
                            .add(findNameLabel)
                            .add(findAdressLabel)
                            .add(findZipCodeLabel)
                            .add(findPhoneNoLabel))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(findPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(findPhoneNoSP, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 75, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(findAdressTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(findPanelLayout.createSequentialGroup()
                                .add(findNameTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                .add(findCvrLabel)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                .add(findCvrSP, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 75, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                            .add(findPanelLayout.createSequentialGroup()
                                .add(findZipCodeSP, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(18, 18, 18)
                                .add(findCityLabel)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                .add(findCityTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                            .add(findContactPersonTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                    .add(findPanelLayout.createSequentialGroup()
                        .add(findFindButton)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(findShowAllButton)))
                .addContainerGap())
        );
        findPanelLayout.setVerticalGroup(
            findPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(findPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(findDescriptionLabel)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(findPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(findNameLabel)
                    .add(findNameTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(findCvrLabel)
                    .add(findCvrSP, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(findPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(findAdressLabel)
                    .add(findAdressTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(findPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(findZipCodeLabel)
                    .add(findZipCodeSP, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(findCityLabel)
                    .add(findCityTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(findPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(findPhoneNoLabel)
                    .add(findPhoneNoSP, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(findPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(findContactPersonLabel)
                    .add(findContactPersonTF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(findPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(findFindButton)
                    .add(findShowAllButton))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(findResultScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 121, Short.MAX_VALUE)
                .addContainerGap())
        );

        supplierTabbedPane.addTab("Søg", findPanel);

        getDescriptionLabel.setText("Her søges på leverandørens ID");

        getIdLabel.setText("ID:");

        getGetButton.setText("Hent");
        getGetButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                getGetButtonActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout getPanelLayout = new org.jdesktop.layout.GroupLayout(getPanel);
        getPanel.setLayout(getPanelLayout);
        getPanelLayout.setHorizontalGroup(
            getPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(getPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(getPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(getDescriptionLabel)
                    .add(getPanelLayout.createSequentialGroup()
                        .add(getIdLabel)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(getIdSP, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(getGetButton))
                .addContainerGap(207, Short.MAX_VALUE))
        );
        getPanelLayout.setVerticalGroup(
            getPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(getPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(getDescriptionLabel)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(getPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(getIdLabel)
                    .add(getIdSP, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(28, 28, 28)
                .add(getGetButton)
                .addContainerGap(275, Short.MAX_VALUE))
        );

        supplierTabbedPane.addTab("Hent", getPanel);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(supplierTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(supplierTabbedPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 456, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

	private void addAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addAddButtonActionPerformed
		if (!addNameTF.getText().equals("") && !addAdressTF.getText().equals("") && !addZipCodeSP.getValue().equals(0) && !addCityTF.getText().equals("") && !addPhoneNoSP.getValue().equals(0) && !addContactPersonTF.getText().equals("") && !addCvrSP.getValue().equals(0))
		{
			this.controller.addSupplier(addNameTF.getText(), addAdressTF.getText(), Integer.parseInt(addZipCodeSP.getValue().toString()), addCityTF.getText(), Integer.parseInt(addPhoneNoSP.getValue().toString()), addContactPersonTF.getText(), Integer.parseInt(addCvrSP.getValue().toString()));
			JOptionPane.showMessageDialog(this, "Udlejning oprettet", addNameTF.getText()+" er nu blevet oprettet som leverandør.", JOptionPane.INFORMATION_MESSAGE);
			addNameTF.setText("");
			addAdressTF.setText("");
			addZipCodeSP.setValue(0);
			addCityTF.setText("");
			addPhoneNoSP.setValue(0);
			addContactPersonTF.setText("");
			addCvrSP.setValue(0);
		}
		else
		{
			JOptionPane.showMessageDialog(this, "En eller flere informationer mangler.", "Manglende indtastning.", JOptionPane.WARNING_MESSAGE);
		}
	}//GEN-LAST:event_addAddButtonActionPerformed

	private void findFindButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_findFindButtonActionPerformed
		int zipcode = Integer.parseInt(findZipCodeSP.getValue().toString());
		int phoneno = Integer.parseInt(findPhoneNoSP.getValue().toString());
		int cvr = Integer.parseInt(findCvrSP.getValue().toString());
		findTable.setModel(
			new SupplierTableModel(
				this.controller.findSupplier(
									findNameTF.getText(),
									findAdressTF.getText(),
									zipcode,
									findCityTF.getText(),
									phoneno,
									findContactPersonTF.getText(),
									cvr)));
	}//GEN-LAST:event_findFindButtonActionPerformed

	private void getGetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_getGetButtonActionPerformed
		Supplier supplier = this.controller.getSupplier(Integer.parseInt(getIdSP.getValue().toString()));
		if(supplier != null)
		{
			new SupplierInfoView(supplier).setVisible(true);
		}
		else
		{
			JOptionPane.showMessageDialog(this, "Der er angivet et forkert ID.", "Forkert ID", JOptionPane.ERROR_MESSAGE);
		}
	}//GEN-LAST:event_getGetButtonActionPerformed

	private void findShowAllButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_findShowAllButtonActionPerformed
	{//GEN-HEADEREND:event_findShowAllButtonActionPerformed
		findTable.setModel(new SupplierTableModel(this.controller.getAllSuppliers()));
	}//GEN-LAST:event_findShowAllButtonActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton addAddButton;
    private javax.swing.JLabel addAdressLabel;
    private javax.swing.JTextField addAdressTF;
    private javax.swing.JLabel addCityLabel;
    private javax.swing.JTextField addCityTF;
    private javax.swing.JLabel addContactPersonLabel;
    private javax.swing.JTextField addContactPersonTF;
    private javax.swing.JLabel addCvrLabel;
    private javax.swing.JSpinner addCvrSP;
    private javax.swing.JLabel addDescriptionLabel;
    private javax.swing.JLabel addNameLabel;
    private javax.swing.JTextField addNameTF;
    private javax.swing.JPanel addPanel;
    private javax.swing.JLabel addPhoneNoLabel;
    private javax.swing.JSpinner addPhoneNoSP;
    private javax.swing.JLabel addZipCodeLabel;
    private javax.swing.JSpinner addZipCodeSP;
    private javax.swing.JLabel findAdressLabel;
    private javax.swing.JTextField findAdressTF;
    private javax.swing.JLabel findCityLabel;
    private javax.swing.JTextField findCityTF;
    private javax.swing.JLabel findContactPersonLabel;
    private javax.swing.JTextField findContactPersonTF;
    private javax.swing.JLabel findCvrLabel;
    private javax.swing.JSpinner findCvrSP;
    private javax.swing.JLabel findDescriptionLabel;
    private javax.swing.JButton findFindButton;
    private javax.swing.JLabel findNameLabel;
    private javax.swing.JTextField findNameTF;
    private javax.swing.JPanel findPanel;
    private javax.swing.JLabel findPhoneNoLabel;
    private javax.swing.JSpinner findPhoneNoSP;
    private javax.swing.JScrollPane findResultScrollPane;
    private javax.swing.JButton findShowAllButton;
    private javax.swing.JTable findTable;
    private javax.swing.JLabel findZipCodeLabel;
    private javax.swing.JSpinner findZipCodeSP;
    private javax.swing.JLabel getDescriptionLabel;
    private javax.swing.JButton getGetButton;
    private javax.swing.JLabel getIdLabel;
    private javax.swing.JSpinner getIdSP;
    private javax.swing.JPanel getPanel;
    private javax.swing.JTabbedPane supplierTabbedPane;
    // End of variables declaration//GEN-END:variables
}